<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('上级催办电话工单')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="post-form">
                <div class="select-list">
                    <ul>
                        <li>
                            工单编号：<input type="text" name="myTwfNO"/>
                        </li>
                        <li>
                            派发单位：<input type="text" name="sdeptName"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>
        <div class="btn-group-sm " id="toolbar" role="group">
            <a class="btn btn-info" onclick="$.table.exportExcel()">
                <i class="fa fa-download"></i> 导出
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:src="@{/common/js/common.js}"></script>
<script th:inline="javascript">
    var prefix = ctx + "system/mTelWF";
    var mInterior = ctx + "system/mInterior";
    $(function () {
        var options = {
            url: prefix + "/cmnFile/supUrgeTelOrderJson",
            exportUrl: prefix + "/cmnFile/supUrgeTelOrderExport",
            sortName: "pkId",
            sortOrder: "desc",
            uniqueId: "pkId",
            modalName: "已删除电话工单",
            fixedColumns: true,
            fixedNumber: 2,
            fixedRightNumber: 4,
            columns: [{
                checkbox: true
            },
                {field: 'PkId', title: 'PkId',visible:false},
                {field: 'WfId', title: 'WfId',visible:false},
                {field: 'BackState', title: 'BackState',visible:false},
                {field:'myTwfNO',title:'工单编号',align:'center',sortable:true,formatter:function(value,row,index){return fmtScanByNO(value,row,index);}},
                {field:'myTwfTopic',title:'工单主题',align:'center', formatter:function (value, row, index,field) {
                        return "<span style='cursor: pointer;' title='"+value+"'>"+value+"</span>"
                    },
                    cellStyle: cellEllipsis
                },
                {field: 'FmContent', title: '工单内容', align: 'center',formatter:function (value, row, index,field) {
                        return "<span style='cursor: pointer;' title='"+value+"'>"+value+"</span>"
                    },
                    cellStyle: cellEllipsis},
                {field: 'SeqName', title: '交办次序', align: 'center'},
                {field: 'SortName', title: '性质', align: 'center'},
                {field: 'DealName', title: '办理方式', align: 'center'},
                {field: 'bkLimit', title: '办理期限', align: 'center', sortable: true},
                {field: 'sdDate', title: '派发日期', align: 'center', sortable: true, width: '100px'},
                {field: 'SDeptName', title: '派发单位', align: 'center'},
                {field:'SBDeptName',title:'承办部门',align:'left',sortable:true},
                {field: 'SendState', title: '签收情况', align: 'center', sortable: true, formatter: function (value, row, index) {
                        return fmtSBSendState(value, row, index);}
                },
                {field: 'BackState', title: '回复情况', align: 'center', sortable: true, formatter: function (value, row, index) {
                        return fmtSBBackState(value, row, index);}
                },
                {title: '操作', align: 'center', formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="detail('+row.WfId+')"><i class="fa"></i>查看</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });


    function fmtScanByNO(value,row,index){
        var idwf = row.WfId;
        return '<a href="javascript:void(0);" onclick="detail('+idwf+')" title="单击查看详情" class="lstWd">'+value+'</a>';
    }


    //查看办结工单详情
    function detail(id) {
        var wfId = '';
        if (id === '') {
            let row = $("#bootstrap-table").bootstrapTable('getSelections');
            var wfId = row[0].WfId;
        }else{
            wfId = id;
        }
        if (wfId) {
            var url = ctx + "system/test/caseDeleteDetail/"+wfId;
            var title = "电话工单详情";
            $.modal.openTab(title, url);
        }
    }
</script>
</body>
</html>